{% extends "base.html" %}
{% load bootstrap3 %}
{% block title %}设备归属查询{% endblock %}
{% block head_script_block %}
<script src="/js/show_rawdata_realtime.js"></script>

    <script type="text/javascript" language="javascript" class="init">

        $(document).ready(function() {
            $( "#ap_status" ).dataTable(
                {
                    "sDom": 'T<"clear">lfrtip',
                    "tableTools": {
                        "aButtons": [
                            {
                                "sExtends": "csv",
                                "oSelectorOpts": {
                                    page: 'all'
                                },
                                "sButtonText": "导出CSV"
                            },
                            {
                                "sExtends": "xls",
                                "oSelectorOpts": {
                                    page: 'all'
                                },
                                "sButtonText": "导出EXCEL"
                            }
                        ]
                    },
                    "oLanguage":{
                        'url':'/js/dataTables.language.chinese.json'
                    }
            });
        } );
    </script>
{% endblock %}

{% block body_content_block %}




    <div class="span4" name="raw">
        <legend>设备列表</legend>
        <form action="." method="POST">{% csrf_token %}
            <button type="submit" class="btn" onclick="">查询</button>
            <br>
            <textarea name="devices" id="devices" style="margin: 0px 0px 10px; width: 80%;" rows="20" placeholder="设备mac地址列表,以换行符分割">{% if devices %}{{ devices }}{% endif %}</textarea>
        </form>
    </div>
    <div class="span8">
        <legend>设备归属</legend>
        {% if datas %}

        <table class="table table-bordered" id="ap_status">
            <thead>
            <tr>
                <th>设备id</th>
                <th>门店</th>
                <th>区域</th>
                <th>城市</th>
                <th>省份</th>
                <th>公司</th>
            </tr>
            </thead>
            <tbody>
            {% for device,data in datas.items %}
            <tr>

                <td>{{ device }}</td>
                <td>{{ data.group_name }}({{ data.group_id }})</td>
                <td>{{ data.dist }}</td>
                <td>{{ data.city }}</td>
                <td>{{ data.prov }}</td>
                <td>{{ data.comp_name }}({{ data.comp_id }})</td>
            </tr>
            {% endfor %}
            </tbody>
        </table>

        {% endif %}
    </div>


<script  type="text/javascript">

</script>


{% endblock %}
